package com.yml.mall.utils;

import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName RedisUtil
 * @Author Administrator
 * @Date 2020/4/13   13:35
 */
@Component
public class StringRedisUtil<T> {

    private HashOperations<String,String,String> hashOperations;

    public StringRedisUtil(RedisTemplate<String, String> redisTemplate){
        hashOperations=redisTemplate.opsForHash();
    }


    public  void removeHashRedis (String h,String hk){
        hashOperations.delete(h,hk);
    }

    public String getOneHashRedis(String h,String hk){
        return hashOperations.get(h,hk);
    }

    public  List<String> getAllValueHashRedis(String h){
        return hashOperations.values(h);
    }


}
